<template>
  <div>
    <comment
      :msg="msg"
      :postTitle="postTitle"
      :list="list"
      @eventObj="eventObjFun"
    ></comment>
  </div>
</template>

<script>
  import comment from '@/components/index-child';
  import { getBanner } from '@/api/index';
  import { mapState, mapMutations } from 'vuex';
  export default {
    data() {
      return {
        msg: 'hello word',
        postTitle: 'you you you',
        list: [{
          id: 1,
          name: '111',
        },{
          id: 2,
          name: '222',
        },{
          id: 3,
          name: '333',
        },{
          id: 4,
          name: '444',
        }]
      }
    },
    components: {
      comment,
    },
    mounted() {
      this.init();
    },
    computed: {
      ...mapState(['global_id', 'token']),
    },
    methods: {
      ...mapMutations(['getToken']),
      eventObjFun(val) {
        this.list = this.list.concat(val);
      },
      init() {
        let param = {username: '李阳阳', age: '23', wx_name: 'Y.'};

        this.getToken(param);

        getBanner().then((res) => {
          console.log(res);
        })
      },
    }
  }
</script>

<style>

</style>
